/**
* Created by ren on 2017/1/3.
*/
<template>
  <div class='dingTouDetail page-wrap'>
    <Nav :cut="'dingtou'"></Nav>
    <div class="container">
      <div class="dingtoudetail page">
        <template v-if="showServerAgreement">
          <UserServerAgreement :_parentThis="this"></UserServerAgreement>
        </template>
        <template v-else>
          <DingTou :_parentThis="this" :dingtouData="dingtouData"></DingTou>
          <div class='product'>
            <div class="title"><i></i><span>产品介绍</span><i></i></div>
            <div v-html="dingtouData.introduce" style="padding: 0 20px"></div>
          </div>
        </template>
      </div>
    </div>
    <div class="overlayer" @touchmove.stop :class="{'show':showServerAgreement}">
    </div>
    <Notify :parentThis='this'></Notify>
  </div>
</template>

<script>
  import Nav from './components/Nav'
  import DingTou from './components/home/DingTou'
  import UserServerAgreement from './components/UserServerAgreement'

  import API from './api'
  import Notify from './components/Notify'
  export default {
    name: 'dingTouDetail',
    components: {
      DingTou,
      Nav,
      UserServerAgreement,
      Notify
    },
    data: function () {
      return {
        dingtouData: '',
        showServerAgreement: false,
        serverIsTrue: false,
        notifyStatus: 2,
        dtTit: true
      }
    },
    methods: {
      findRegularPutin: function () {
        var id = this.$cookie.get('id')
        this.$http.post(API.findRegularPutin, {
          userId: id
        }).then((ret) => {
          const result = ret.body
          if (result.code === 1) {
            this.dingtouData = result.object
          } else {
            this.notifyStatus = '0|' + result.message
          }
        }, (err) => {
          console.log(err)
        })
      }
    },
    mounted: function () {
      this.findRegularPutin()
    }
  }
</script>
